<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册信息</title>
<style type="text/css">
	#toolTip {
		display: none;
	}
</style>
</head>
<body>
	<form action="" method="post" name="form1">
		用户名：<input name="username" type="text" id="username" size="32">
		<img alt="" src="checkBt.png" width="23" height="23" style="cursor: hand" onclick="checkUser(form1.username);" />
		<br>
		密码：<input name="pwd1" type="password" id="pwd1" size="35"><br>
		确认密码：<input name="pwd2" type="password" id="pwd2" size="35"><br>
		E-mail:<input name="mail" type="text" id="mail" size="45"><br>
		
	</form>
	<div id="toolTip"></div>
	
	<script type="text/javascript">
		var http_request;
		function createRequest(url) {
			http_request = false;
			if (window.XMLHttpRequest) {
				http_request = new XMLHttpRequest();
			} else if (window.ActiveXObject) {
				try {
					http_request = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						http_request = new ActiveXObject("Mcrosoft.XMLHTTP");
					} catch (e) { }
				}
			}
			if (!http_request) {
				alert("不能创建XMLHttpRequest对象");
				return false;
			}
			http_request.onreadystatechange = getResult;
			http_request.open("POST", url, true);
			http_request.send(null);
		}
		function getResult() {
			if (http_request.readyState == 4) {
				if (http_request.status == 200) {
					document.getElementById("toolTip").innerHTML = http_request.responseText;
					document.getElementById("toolTip").style.display = "block";
				} else {
					alert("您所请求的页面发生错误");
				}
			}
		}
		function checkUser(username) {
			if (username.value == "") {
				alert("请输入用户名");
			} else {
				createRequest("checkUser.jsp?user=" + username.value);
			}
		}
	</script>
</body>
</html>